package com.qzsoft.zhjd.materiel.modules.materielgas.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qzsoft.jeemis.common.validator.group.AddGroup;
import com.qzsoft.jeemis.common.validator.group.UpdateGroup;

import lombok.*;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName MaterielGasEntity
 * @Description 天然气抄表
 * @author linhuawei
 * @since 2022-04-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@TableName("n_materiel_gas")
public class MaterielGasEntity {
    /**
     * 主键
     */
    @NotBlank(groups = UpdateGroup.class, message = "数据标识不可为空")
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 所选基地编码
     */
    @NotBlank(groups = { AddGroup.class, UpdateGroup.class }, message = "基地编码不能为空！")
    private String baseCode;

    /**
     * 燃气量
     */
    @NotNull(groups = { AddGroup.class, UpdateGroup.class }, message = "燃气量不能为空！")
    @DecimalMax(value = "99999999999999999999.99999", message = "燃气量不可超过{value}")
    private BigDecimal gasNum;

    /**
     * 上次抄表数值
     */
    private BigDecimal preGasNum;
    
    /**
     * 使用量
     */
    private BigDecimal useGasNum;

    /**
     * 抄表时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date readingTime;

    @Length(groups = { AddGroup.class, UpdateGroup.class }, max = 200, message = "备注不可超过{max}个字")
    private String remark;

    /**
     * 添加人主键
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createDate;

    /**
     * 最后修改人主键
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 最后修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

}
